<?php require 'header.php';?>
  <link type="text/css" rel="stylesheet" href="/assets/css/editor.css" />
  <script type="text/javascript" src="/assets/js/editor.js"></script>
  <div class="mainDiv">
    <div class="innerMain">
      <div class="innerTab"> <span class="announceT">漏洞提交</span> </div>
      <div class="bugSubForm">
        <form id="bugForm" action="<?php echo Qtpl::createUrl('bug', 'sub');?>" method="post">
          <ul class="bugSubFormUl">
            <li> <span class="itemName">漏洞名称：</span>
              <input type="text" class="iteminp" name="title"/>
            </li>
            <li> <span class="itemName">漏洞类型：</span>
              <select id="p_cate" name="">
                <option value="">--选择漏洞大类--</option>
				<?php 
				foreach ($_tpl['cate'] as $v){
					echo "<option value='{$v['cid']}'>{$v['cate_name']}</option>";
				}
				?>
              </select>
              <select id="c_cate" name="cate_id">
                
              </select>
            </li>
            <li> <span class="itemName">危害等级：</span>
              <select name="level">
                <option value="3">高危</option>
                <option value="2">中危</option>
                <option value="1">低危</option>
              </select>
            </li>
            <input type="hidden" name="token" id="token" value="<?php echo $_tpl['token'];?>"/>
            <li> <span class="itemName">自评分数：</span>
              <input type="text" class="input-min" name="rank"/>(低1-5,中5-10,高10-20)
            </li>
            <li> <span class="itemName" style="float:left">漏洞描述：</span>
              <div class="editor" style="float:left; width:83%">
                <div id="editor_tools" class="tools">initializing...</div>
                <textarea id="editor_content" style="width:98%" name="content">
1、漏洞发现方式

2、漏洞证明

3、修复方案

4、请提供联系方式，方便漏洞确认</textarea>
              </div>
            </li>
            <li style="clear:both;padding-top:20px;"> <span class="itemName"></span>
              <input type="button" id="bugSub" class="button white" value="提交漏洞">
            </li>
          </ul>
        </form>
      </div>
    </div>
  </div>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script language="javascript">
	Editor("editor_content","editor_tools",["B","I","U","img","video","link","code"],260);
	$("#p_cate").change(function() {
		var sObj = $("#p_cate");
		var pid = parseInt(sObj.val());			
		$.getJSON('<?php echo Qtpl::createUrl('api','getcate');?>',{'pid':pid},function(json){
			if(json.state == 1){
				$("#c_cate").html(json.html);
			}
		});
	});
	$("#bugSub").click(function(){
		var f = $("#bugForm");
		$.post(f.attr('action'),f.serialize(),function(json){
			if(json.state == 1){
				alert(json.msg);
				location.href = json.url;
			}else{
				if(json.url) $("#token").val(json.url);
				alert(json.msg);
			}
		},'json');
	});
</script>
  <?php require 'footer.php';?>